namespace Brjnk.GpxExplorer.WPF
{
    using System;
    using System.Windows.Controls;
    using System.Windows.Input;
    using Brjnk.GpxExplorer.UI;

    /// <summary>
    /// </summary>
    public class OpenInWindowCommand : ICommand
    {
        public bool CanExecute(object parameter)
        {
            return true;
        }

        public event EventHandler CanExecuteChanged;

        public void Execute(object parameter)
        {
            if ((object)parameter == null) return;
            if (!(parameter is ContentControl)) throw new InvalidOperationException();
            DetailsWindow window = new DetailsWindow((ContentControl)parameter);
            window.Show();
        }
    }
}